#include "ProcessPool.hpp"
//#include "Task.hpp"
void Usage(string proc)
{
    cout << "Usage :" << proc << "process nums" << endl;
}

void DegBUg(vector<channel> &channels)
{
    for (auto e : channels)
    {
        cout << e.Name() << endl;
    }
}
int main(int argc, char *argv[])
{

    if (argc != 2)
    {
        Usage(argv[0]);
        return ARGCEROOR;
    }

    // vector<channel> channels;
    int nums = stoi(argv[1]);
    ProcessPool *pp = new ProcessPool(nums, Work);
    // 创建进程池
    pp->InitProcesspool();
    // 派发任务
    pp->DispatchTask();

    // 关闭进程池
    pp->CloseProcessPool();
    // 创建进程池
    // InitProcesspool(nums, channels, Work);
    // // DegBUg(channels);

    // // 派发任务
    // DispatchTask(channels);

    // // 关闭进程池
    // CloseProcessPool(channels);

    delete pp;
    return 0;
}